<?php

    function __printr($dataObject = array()) {
        echo "<pre>";
        print_r($dataObject);
        echo "</pre>";
    }

    function redirect($url= "", $time=0, $target="_self", $type='html')
    {
        if($type == 'html') {
            echo '<meta http-equiv="refresh" content="'.$time.';url='.$url.'">';
        } else {
            $time= $time*1000;
            if($target=="_self") {
                echo '<script language="javascript">setTimeout("window.location.href=\''.$url.'\'", '.$time.'); </script>';
            } else {
                echo '<script language="javascript">setTimeout("window.open(\''.$url.'\')"); </script>';
            }
        }
    }

    function getBaseUrl(){
        return 'http://' . $_SERVER['HTTP_HOST'] . str_replace(array('main.php','index.php', "cp.php"), '', $_SERVER['SCRIPT_NAME']);
    }
